// Copyright 2012, Jun Chen .All rights reserved.
//
// Use of this source code is governed by a BSD-Style license that can be
// found in the License fule.
//
// Author: cpp.cheen at gmail dot com.


#ifndef THREAD_WARPER_H
#define THREAD_WARPER_H

#include    <boost/thread.hpp>
#include    <boost/function.hpp>

class thread_warper
{
    typedef boost::function<void()> thread_func;
    public:
        /** Default constructor */
        thread_warper(thread_func func);
        /** Default destructor */
        virtual ~thread_warper();

        void    start();
        void    join();
        bool    is_running();
    protected:
    private:
    thread_func     m_func;
    boost::thread*  m_thread_impl;
    bool            m_running;
};

#endif // THREAD_WARPER_H
